/* 
 * Copyright (C) 2001-2003 Jacek Sieka, j_s@telia.com
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#include "stdafx.h"
#include "../client/DCPlusPlus.h"
#include "Resource.h"

#include "ReportFrame.h"
#include "WinUtil.h"
//Sulan start svn127
void ReportFrame::openWindow(const string& aMessage, const string& aNick) {
	ReportFrame* frame = new ReportFrame(aMessage, aNick);
	//End
	frame->CreateEx(WinUtil::mdiClient);
}

LRESULT ReportFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) {
	ctrlPad.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 
		WS_VSCROLL | ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL | ES_READONLY, WS_EX_CLIENTEDGE);
	
	ctrlPad.LimitText(0);
	//Sulan start svn127
	WinUtil::decodeFont(SETTING(REPORT_FONT), reportFont);
	ctrlPad.SetFont(::CreateFontIndirect(&reportFont));	
	//ctrlPad.SetFont(WinUtil::monoFont);
	//End
	
	ctrlPad.SetWindowText(mes.c_str());
		
	SetWindowText((' ' + STRING(REPORT) + " - " + n + ' ').c_str());

	m_hMenu = WinUtil::mainMenu;

	bHandled = FALSE;
	return 1;
}

void ReportFrame::UpdateLayout(BOOL /*bResizeBars*/ /* = TRUE */) {
	CRect rc;
	GetClientRect(rc);
	rc.bottom -= 1;
	rc.top += 1;
	rc.left +=1;
	rc.right -=1;
	ctrlPad.MoveWindow(rc);
}

/**
 * @file
 * $Id: ReportFrame.cpp 306 2005-08-20 15:49:52Z Pothead $
 */